package com.sky.controller.user;

import com.sky.dto.OrdersRejectionDTO;
import com.sky.dto.OrdersSubmitDTO;
import com.sky.result.Result;

import com.sky.service.user.UserOrderService;
import com.sky.vo.OrderSubmitVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 订单
 */
@RestController("userOrderController")
@RequestMapping("/user/order")
@Slf4j
@Api(tags = "C端-订单接口")
public class UserOrderController {

    @Autowired
    private UserOrderService orderService;

    /**
     * 用户下单
     *
     * @param ordersSubmitDTO
     * @return
     */
    @PostMapping("/submit")
    @ApiOperation("用户下单")
    public Result<OrderSubmitVO> submit(@RequestBody OrdersSubmitDTO ordersSubmitDTO) {
        log.info("用户下单：{}", ordersSubmitDTO);
        OrderSubmitVO orderSubmitVO = orderService.submitOrder(ordersSubmitDTO);
        return Result.success(orderSubmitVO);
    }
    @GetMapping("/getEstimatedDeliveryTime")
    public Result<String> getEstimatedDeliveryTime(Integer shopId,String customerAddress){

        return orderService.getgetEstimatedDeliveryTime(shopId,customerAddress);
    }
    @GetMapping("/reminder/{orderId}")
    @ApiOperation("用户催单提醒")
    public Result reminderHurryUp(@PathVariable Integer orderId){
        log.info("拿到的order ID为：{}",orderId);
        return orderService.reminderHurryUp(orderId);
    }




}